package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SearchRuleMapper;
import com.ruoyi.system.domain.SearchRule;
import com.ruoyi.system.service.ISearchRuleService;
import com.ruoyi.common.core.text.Convert;

/**
 * 检索规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-22
 */
@Service
public class SearchRuleServiceImpl implements ISearchRuleService 
{
    @Autowired
    private SearchRuleMapper searchRuleMapper;

    /**
     * 查询检索规则
     * 
     * @param id 检索规则主键
     * @return 检索规则
     */
    @Override
    public SearchRule selectSearchRuleById(Long id)
    {
        return searchRuleMapper.selectSearchRuleById(id);
    }

    /**
     * 查询检索规则列表
     * 
     * @param searchRule 检索规则
     * @return 检索规则
     */
    @Override
    public List<SearchRule> selectSearchRuleList(SearchRule searchRule)
    {
        return searchRuleMapper.selectSearchRuleList(searchRule);
    }

    /**
     * 新增检索规则
     * 
     * @param searchRule 检索规则
     * @return 结果
     */
    @Override
    public int insertSearchRule(SearchRule searchRule)
    {
        return searchRuleMapper.insertSearchRule(searchRule);
    }

    /**
     * 修改检索规则
     * 
     * @param searchRule 检索规则
     * @return 结果
     */
    @Override
    public int updateSearchRule(SearchRule searchRule)
    {
        return searchRuleMapper.updateSearchRule(searchRule);
    }

    /**
     * 批量删除检索规则
     * 
     * @param ids 需要删除的检索规则主键
     * @return 结果
     */
    @Override
    public int deleteSearchRuleByIds(String ids)
    {
        return searchRuleMapper.deleteSearchRuleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除检索规则信息
     * 
     * @param id 检索规则主键
     * @return 结果
     */
    @Override
    public int deleteSearchRuleById(Long id)
    {
        return searchRuleMapper.deleteSearchRuleById(id);
    }

    public int changeStatus(SearchRule searchRule){
        return searchRuleMapper.updateSearchRule(searchRule);
    }

    @Override
    public List<String> selectUniqueRuleNameList(SearchRule spSearchRule){
        return searchRuleMapper.selectUniqueRuleNameList(spSearchRule);
    }
}
